import 'package:flutter/material.dart';
import 'live_widget.dart';
import 'short_video_widget.dart';

class SystemPage extends StatefulWidget {
  const SystemPage({super.key});

  @override
  State<SystemPage> createState() => _SystemPageState();
}

class _SystemPageState extends State<SystemPage> with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(vsync: this, length: 2);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: TabBar(
            controller: _tabController,
            isScrollable: true,
            tabAlignment: TabAlignment.center,
            onTap: (value) {
              print('点击tab');
              print(value);
            },
            tabs: const [
              Tab(text: '短视频'),
              Tab(
                text: '直播',
              )
            ],
          ),
        ),
        body: TabBarView(
          controller: _tabController,
          children: const [
            ShortVideoWidget(),
            LiveWidget(),
          ],
        ));
  }
}
